/* 
              RC_Serial_Print

              by: Russ Sutton
  Use this program to display RC Rx Output 
  signals for easier RC Tx Tunning. 

Set serial port to 56700
           
              
              
*/              

int ch1 = 0;          // Gives digital pin 0 a name
int ch2 = 1;          // Gives digital pin 1 a name
int ch3 = 2;          // Gives digital pin 2 a name 
int ch4 = 9;          // Gives digital pin 9 a name
int ch5 = 10;         // Gives digital pin 10 a name
int ch6 = 11;         // Gives digital pin 11 a name
int ch7 = 12;         // Gives digital pin 12 a name
int ch8 = 13;         // Gives digital pin 13 a name

unsigned long duration1;  // place to record inpulse
unsigned long duration2;
unsigned long duration3;
unsigned long duration4;
unsigned long duration5;
unsigned long duration6;
unsigned long duration7;
unsigned long duration8;

void setup()
{
  pinMode(ch1, INPUT);    // Tells Aduino pins are inputs
  pinMode(ch2, INPUT);
  pinMode(ch3, INPUT);
  pinMode(ch4, INPUT);
  pinMode(ch5, INPUT);
  pinMode(ch6, INPUT);
  pinMode(ch7, INPUT);
  pinMode(ch8, INPUT);
  Serial.begin(57600);
}

void loop()
{
  duration1 = pulseIn(ch1, HIGH);    //records inpulse from RC Rx
  duration2 = pulseIn(ch2, HIGH);
  duration3 = pulseIn(ch3, HIGH);
  duration4 = pulseIn(ch4, HIGH);
  duration5 = pulseIn(ch5, HIGH);
  duration6 = pulseIn(ch6, HIGH);
  duration7 = pulseIn(ch7, HIGH);
  duration8 = pulseIn(ch8, HIGH);
  
  Serial.print("CH 1  ");            // Prints data to serial port
  Serial.print(duration1);
  Serial.print(",");
  Serial.print("  CH 2   ");
  Serial.print( duration2);
  Serial.print(",");
  Serial.print("  CH 3   ");
  Serial.print( duration3);
  Serial.print(",");
  Serial.print("  CH 4   ");
  Serial.println( duration4);
  Serial.print(",");
  Serial.print("  CH 5   ");
  Serial.print( duration5);
  Serial.print(",");
  Serial.print("  CH 6   ");
  Serial.print( duration6);
  Serial.print(",");
  Serial.print("  CH 7   ");
  Serial.print( duration7);
  Serial.print(",");
  Serial.print("  CH 8   ");
  Serial.println( duration8);
  Serial.print(" ");
  Serial.println(" " );
  delay(2000);                      //changes smaple rate 2000 = 2 seconds

  
}


